package base.chap3;

/**
 * ${DESCRIPTION}
 *
 * @author luoyalan
 * @date 2018/9/22
 */
public class Demo {
    public static void main(String[] args) {
        Manager man = new Manager();

        Employee em = new Employee();

        Gender2 gender1 = new Male();

        Gender2 gender2 = new Female();

        gender1.print(man);

        gender2.print(em);
    }
}

class Person2 {

    public void print() {
        System.out.print("Person ");
    }

    public void printMyGender(String s) {

        this.print();

        System.out.print(s + " ");

    }

}

class Gender2 {

    String type = "gender";

    public void print(Person2 p) {
        p.printMyGender(type);
    }

}

class Female extends Gender2 {

    public Female() {
        type = "female";
    }

}

class Male extends Gender2{

    public Male(){

        type="male";

    }

}

class Employee extends Person2{

    @Override
    public void print(){

        System.out.print("Employee ");}

}

class Manager extends Employee{

    @Override
    public void print(){

        System.out.print("Manager ");}

}





